home *** CD-ROM | disk | FTP | other *** search
- property sprAnima, periodo, tempo, prefixo
- property numAnimacoes, numAnima
-
- on getBehaviorDescription
- return "Troca animacoes de sprites (a primeira ja deve estar setada)"
- end
-
- on getPropertyDescriptionList
- set p_list = [ ¬
- #sprAnima: [ #comment: "Sprite com animacao",¬
- #format: #integer,¬
- #default: 0 ],¬
- #periodo: [ #comment: "Periodo antes da troca",¬
- #format: #integer,¬
- #default: 600 ],¬
- #prefixo: [ #comment: "Prefixo",¬
- #format: #string,¬
- #default: "Anima" ],¬
- #numAnimacoes: [ #comment: "Numero de animacoes",¬
- #format: #integer,¬
- #default: 2 ]¬
- ]
- return p_list
- end
-
- on beginSprite me
- if sprAnima = 0 then set sprAnima = the spriteNum of me
- set tempo = 0
- set numAnima = 1
- end
-
- on idleSprite
- if tempo = 0 then set tempo = the timer
-
- if the timer - tempo > periodo then
- set numAnima = numAnima + 1
- if numAnima > numAnimacoes then set numAnima = 1
- set nomePrim = prefixo & numAnima & "-prim"
- set nomeUlt = prefixo & numAnima & "-ult"
- set the memberPrim of sprite sprAnima to nomePrim
- set the memberUlt of sprite sprAnima to nomeUlt
- sendSprite(sprAnima,#inicializaAnima)
- set tempo = the timer
- end if
- end